package com.tg.app.helper;

import android.content.Context;

import com.tange.module.device.feature.DeviceFeature;
import com.tg.app.R;
import com.tange.base.toolkit.DimenUtil;
import com.tange.base.toolkit.PreferenceUtil;
import com.tange.base.toolkit.StatusBarUtil;
import com.tg.data.media.AVPlayerUtils;

public class CameraViewHelper {
    public static int getPlaybackHeight(DeviceFeature mDeviceFeature , Context context) {
        int h50 = DimenUtil.dp2px(context, 50);
        if (supportMultiChannelsPlaybackVertical(mDeviceFeature,context)){
            int h = context.getResources().getDisplayMetrics().widthPixels;
            int playerHeight = h*9 / 16;;
            return playerHeight*2+h50;
        }
        int playerHeight = (int) context.getResources().getDimension(R.dimen.player_height);
        return playerHeight + h50;
    }
    public static boolean supportMultiChannelsPlaybackVertical(DeviceFeature mDeviceFeature,Context context){
        int h = context.getResources().getDisplayMetrics().heightPixels;
        int max = 2180- StatusBarUtil.getStatusBarHeight();
        return DeviceFeatureHelper.supportMultiChannels(mDeviceFeature)&&h>max;
    }
    public static boolean isTalkback2W(Context context){
        return  PreferenceUtil.getBoolean(context, AVPlayerUtils.TALK_BACK_2_WAY,false);
    }
    public static void talkback2WSave(Context context,boolean isSupport){
          PreferenceUtil.setBoolean(context,AVPlayerUtils.TALK_BACK_2_WAY,isSupport);
    }
}
